package verify

import (
	"github.com/dchest/captcha"
	"github.com/kataras/iris/v12/context"
)

const (
	StdWidth  = 80
	StdHeight = 40
)

// 获取验证码ID
func getCaptchaId(ctx *context.Context) {
	m := make(map[string]interface{}, 0)
	m["status"] = 0
	m["httpCode"] = 200
	m["message"] = "获取成功"
	m["captchaId"] = captcha.NewLen(4)
	ctx.JSON(m)
	return
}

// 获取验证码图片
func getCaptchaImg(ctx *context.Context) {
	captcha.Server(StdWidth, StdHeight).
		ServeHTTP(ctx.ResponseWriter(), ctx.Request())
}